//
// Created by wxd on 2025/8/3.
//

#include "FrameManager.h"

std::unique_ptr<FrameManager> FrameManager::m_Instance = nullptr;

FrameManager &FrameManager::getInstance() {
    if (!m_Instance) {
        m_Instance = std::make_unique<FrameManager>();
    }
    return *m_Instance;
}

void FrameManager::destroyFrameManager() {
    if (m_Instance) {
        m_Instance.reset();
    }
}

void FrameManager::setFrameCounter(std::unique_ptr<FrameCounter> frameCounter) {
    if (frameCounter) {
        m_FrameCounter = std::move(frameCounter);
    }
}

void FrameManager::updateFrameCounter() const {
    if (m_FrameCounter) {
        m_FrameCounter->updateFrame();
    }
}

void FrameManager::clear() {
    if (m_Instance) {
        m_Instance.reset();
    }
}